<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<link rel="stylesheet" type="text/css" href="/css/common.css" />
		<link rel="stylesheet" type="text/css" href="/js/flatpickr.min.css" />
		<link rel="stylesheet" type="text/css" href="/bootstrap-3.3.7/css/bootstrap.min.css" />
		<link rel="stylesheet" type="text/css" href="/dialog/css/dialog.css" />
		<link rel="stylesheet" type="text/css" href="/css/font-awesome.css" />
	</head>

	<body>
		<!--顶部导航 -->
		<nav class="topNavItemBox">
			<div id="ItemBox">
				<div class="title">肉品溯源管理系统</div>
			</div>
		</nav>
		<!-- 左侧导航 -->
		<#include "left.ftl"/>

        <!--生猪出库查询-->
		<div class="page_main">
			<h3>生猪出厂管理</h3><span class="add_link"><a href="/admin/PigOut/toAdd">新增生猪出厂信息></a></span>
			<div class="page_content">
				<h4>生猪出厂查询</h4>
				<br /><br />
				<form id="pinOut_query" method="post" action="/admin/PigOut/findByCondition">
					<!-- <label>生猪名称</label><input type="text" name="" id="vaccine_name" class="commonInputtext" /> -->
					<label style="width:100px">生猪编号</label><input type="text" value="${purGid}" name="purGid" class="commonInputtext" /><span></span>
					<label style="width:100px">开始日期</label><input type="text" value="${beginTime}" name="beginTime" id="start_date" class="commonInputtext" /><span></span>
					<label style="width:100px">结束日期</label><input type="text" value="${endTime}" name="endTime" id="end_date" class="commonInputtext" />
					<input type="submit" value="查询" style="display: inline-block; margin-left: 30px;" />
					
				</form>
				<div>
					<table id="pinOut_table" class="table" width="100%">
						<thead>
							<tr>
								<th width="30"><input type="checkbox" onclick="selectAll()" id="allSelect" class="allSelect" value=""></th>
								<th width="150">生猪编号</th>
								<th width="150">出厂日期</th>
								<th width="150">出厂生猪重量(kg)</th>
								<th width="150">出货养殖厂</th>
								<th width="150">经手人名称</th>
								<th width="150">接收人</th>
								<th width="150">接收电话</th>
								<th width="150">接收屠宰厂</th>
								<th width="150">交货地点</th>
								<th width="80"></th>
							</tr>
						</thead>
						<tbody>
							<#list  pageInfo.list as pigOutVO>
								<tr>
                                    <td width="30"><input  name="isCheck" type="checkbox" value="${pigOutVO.pigOut.gid}"/></td>
                                    <td width="150">${pigOutVO.pigOut.purGid}</td>
                                    <td width="150">${(pigOutVO.pigOut.outtime?string('yyyy-MM-dd hh:mm:ss'))}</td>
                                    <td width="150">${pigOutVO.pigOut.outweight}</td>
                                    <td width="150">${pigOutVO.companyInfo1.compname}</th>
                                    <td width="150">${pigOutVO.pigOut.operatorname}</td>
                                    <td width="150">${pigOutVO.pigOut.receivername}</td>
                                    <td width="150">${pigOutVO.pigOut.recievertel}</td>
                                    <td width="150">${pigOutVO.companyInfo2.compname}</td>
                                    <td width="150">${pigOutVO.pigOut.place}</td>
									<td width="80"><input type="button" onclick="edit1(${pigOutVO.pigOut.gid})"  value="编辑"/></td>
								</tr>
							</#list>

						</tbody>
					</table>
				</div>
				<input type="button" id="delete" onclick="deleteByids()" value="删除所选">
				<#--<div id="barcon" name="barcon" style="margin-left: 200px;font-size:10px"></div>-->
			</div>
			<div class="footer">
				<div class="footer_lineone">
					<span id="logo"></span>肉品溯源管理系统 
					<span class="footer_lineoneSpan"><a href="aboutus.html">关于我们</a></span>
					<span class="footer_lineoneSpan"><a target="_blank" href="http://www.cfsiw.com/">食品安全信息</a></span> 
					<span class="footer_lineoneSpan"><a href="suggestionAdd.ftl">联系我们</a></span>
				</div>
				<div class="footer_linetwo">
					 &copy;2017广东技术师范学院
				</div>
			</div>
		</div>

		<script src="/js/jquery-1.9.1.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="/js/jquery.form.js"></script>
		<script src="/js/jquery.validate.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="/js/messages_zh.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="/js/common.js" type="text/javascript" charset="utf-8"></script>
		<script src="/js/google-maps.js" type="text/javascript" charset="utf-8"></script>
		<script src="/dialog/js/dialog.js"></script>
		<script src="/js/flatpickr.js">
		</script>
		<script type="text/javascript" charset="UTF-8">
			$(function() {
				//侧边栏初始化
				$(".vertical-nav").verticalnav({
					speed: 400,
					align: "left"
				});

				//时间控制初始化
				$("#start_date").flatpickr();
				$("#end_date").flatpickr();

            });

            //全选、全不选
            function selectAll() {
                if ($("#allSelect").is(":checked")) {
                    $("input[name='isCheck']").prop("checked",true);
                } else {
                    $("input[name='isCheck']").prop("checked",false);
                }
            }

            //批量删除
            function deleteByids() {
                var option = $("input[name='isCheck']:checked");
                var selectRows = "";
                for (i = 0; i< option.length;i++){
                    if(i == 0){
                        selectRows += option[i].value;
                    }else{
                        selectRows += "," + option[i].value;
                    }
                }
                $.dialog({
                    type: 'confirm',
                    contentHtml: '<p style:"magrin:0 auto">确认删除？</p>',
                    onClickOk: function() {
                        $.ajax({
                            url: "/admin/PigOut/delete",
                            data: {
                                'selectRows': selectRows
                            },
                            error: function(XMLHttpRequest, textStatus, errorThrown) {
                                //弹失败框
                                $.dialog({
                                    type: 'info',
                                    contentHtml: '<img class="info-icon" src="dialog/images/icon/fail.png" alt="删除失败" /><p class="info-text">删除失败</p>',
                                    autoClose: 1000
                                });
                            },
                            success: function() {
                                //弹成功框
                                $.dialog({
                                    type: 'info',
                                    contentHtml: '<img class="info-icon" src="dialog/images/icon/success.png" alt="删除成功" /><p class="info-text">删除成功</p>',
                                    autoClose: 1000
                                });
                                setTimeout("window.location.reload();",2000);

                            }
                        });
                    }
                });
            }



		</script>

	</body>

</html>